package j04num;

import java.math.BigDecimal;

public class J2xiaoshu {
    public static void main(String[] args) {
        System.out.println(0.1+0.2);//0.30000000004
        System.out.println(0.1+0.2 == 0.3);//false

        System.out.println("====");
        BigDecimal b1 = new BigDecimal("0.1");
        BigDecimal b2 = new BigDecimal("0.2");
        BigDecimal sum = b1.add(b2);
        BigDecimal target = new BigDecimal("0.3");
        //0
        System.out.println(sum.compareTo(target));

    }
}
